package com.atguigu.java.ai.langchain4j.controller;

import com.atguigu.java.ai.langchain4j.assistant.GgAgent;
import com.atguigu.java.ai.langchain4j.assistant.XiaozhiAgent;
import com.atguigu.java.ai.langchain4j.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @author zhaoyf
 * @version 1.0
 * @description 医疗智能体controller
 * @date 2025/8/1 20:45
 */

@RestController
@RequestMapping(value ="/xiaozhi")
@Tag(name = "硅谷小智")
public class XiaozhiController {

    @Resource
    private XiaozhiAgent xiaozhiAgent;
    @Resource
    private GgAgent ggAgent;

//    @Operation(summary = "对话")
//    @PostMapping(value = "/chat",produces = "text/stream;charset=utf-8")
//    public Flux<String> chat(@RequestBody ChatForm requestParam) {
//        return xiaozhiAgent.chat(requestParam.getMemoryId(),requestParam.getMessage());
//    }

    @Operation(summary = "对话")
    @PostMapping(value = "/chat",produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ChatForm requestParam) {
        return ggAgent.chat(requestParam.getMemoryId(),requestParam.getMessage());
    }
}
